package com.zego.wawaji.ui.bean.pay;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

/**
 * 娃娃机列表
 * Created by Su on 2017/12/1.
 */
public class PayList extends BaseData {
    private List<Pay> payList = new ArrayList<>();          // 全部充值列表
    private List<Pay> payNewList = new ArrayList<>();       // 新手包
    private List<Pay> payCommonList = new ArrayList<>();    // 通用列表

    @Override
    public void parseJson(String jsonStr) {
        JSONArray jsonArray = getJsonArray(jsonStr);
        this.payList = (List<Pay>) getBaseDataList(jsonArray, Pay.class);
    }

    public List<Pay> getPayList() {
        return payList;
    }

    public List<Pay> getPayCommonList() {
        if (payCommonList == null) payCommonList = new ArrayList<>();
        payCommonList.clear();
        for (int i = 0; i < payList.size(); i++) {
            if (!payList.get(i).isNew()) {
                payCommonList.add(payList.get(i));
            }
        }
        return payCommonList;
    }

    public List<Pay> getPayNewList() {
        if (payNewList == null) payNewList = new ArrayList<>();
        payNewList.clear();
        for (int i = 0; i < payList.size(); i++) {
            if (payList.get(i).isNew()) {
                payNewList.add(payList.get(i));
            }
        }
        return payNewList;
    }
}
